# coding:utf-8
'''
Created on 2011-3-4

@author: Administrator
'''

uid = "sa"
pwd = "secret"
print "%s is not a good password for %s" % (pwd, uid)

#=================================================================
# 使用字符串格式化可以自动将参数转变为字符串类型，而“+”则不行（使用Tuple传递参数）
#=================================================================
age = 6
print 'my age is %s' % (age,)
# 会抛出异常，因为字符串不能和整数相加（与Java不一样，Java中会自动将整数转换为字符串类型）
# print 'my age is ' + 6

#=============================================
# 数值格式化（如果只有一个参数，则可以直接传递）
#=============================================
print "Today's stock price: %f" % 50.4625
print "Today's stock price: %.2f" % 50.4625
print "Today's stock price: %+.2f" % 1.5

#=============================================
# 使用dictionary传递参数
#=============================================
params = {"name" : "atlantis", "age" : 23}
print "%(name)s's age is %(age)d" % params